package train48days;
import java.util.*;

public class 淘宝网店 {
        //判断是否是闰年
        public static boolean isLeapYear(int n){
            if((n % 4 == 0 && n % 100 != 0) || n % 400 == 0){
                return true;
            }
            return false;
        }
        //判断某一年一共有多少收益
        public static int profitofYear(int year){
            return 2 * 31
                    + 1 * 28
                    + 1 * 31
                    + 2 * 30
                    + 1 * 31
                    + 2 * 30
                    + 1 * 31
                    + 2 * 31
                    + 2 * 30
                    + 2 * 31
                    + 1 * 30
                    + 2 * 31
                    + (isLeapYear(year) ? 1 : 0);
        }
        //判断某一月是否是素数
        public static boolean isPrime(int month){
            return (month == 2 || month == 3 || month == 5 || month== 7 || month == 11);
        }
        //计算从year年的1月1号到year年的month月day号的收益
        public static int profitodThisyear(int year,int month,int day){
            int profit = 0;
            if(!isPrime(month)){
                profit = day * 2;
            }else{
                profit = day;
            }
            while (--month > 0) {
                switch (month) {
                    case 1: case 8: case 10: case 12 :
                        profit += 62;
                        break;
                    case 3: case 5: case 7:
                        profit += 31;
                        break;
                    case 4 : case 6 : case 9:
                        profit += 60;
                        break;
                    case 11:
                        profit += 30;break;
                    default:
                        profit += (28 + (isLeapYear(year) ? 1 : 0));
                        break;
                }
            }
            return profit;
        }
        public static void main(String[] args){

            Scanner sc = new Scanner(System.in);
            while(sc.hasNext()){
                int profit = 0;
                int year1 = sc.nextInt();
                int month1 = sc.nextInt();
                int day1 = sc.nextInt();
                int year2 = sc.nextInt();
                int month2 = sc.nextInt();
                int day2 = sc.nextInt();

                profit = profitofYear(year1) - profitodThisyear(year1,month1,day1 - 1);
                profit += profitodThisyear(year2,month2,day2);
                if(year1 == year2){
                    profit -= profitofYear(year1);
                }
                for(int i = year1 + 1;i < year2;i++){
                    profit += profitofYear(i);
                }
                System.out.println(profit);
            }
        }
    }

